---
title: "ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME dynamic dispatch documentation"
summary: "Analysis of the runtime-dynamic stored procedure dispatch driven by ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME."
status: draft
owner: "SAIF Corporation"
last_reviewed: 2026-08-31
source_schema: "n/a (name supplied by data)"
source_name: "ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME"
source_type: "PROCEDURE (runtime-resolved)"
retrieval_status: "unresolvable-dynamic-name"
retrieval_command: "none possible — no static name to query"
retrieval_date: "2026-08-31"
---

# ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME

## Overview

| Field | Value |
| --- | --- |
| **Schema** | n/a (name supplied by data) |
| **Type** | Runtime-resolved procedure name |
| **Status** | ⚠️ `unresolvable-dynamic-name` — no static procedure name exists to retrieve |
| **Query executed** | none possible — no static name to query |
| **Calling libraries** | `SAIF.Business.View.Policy` |
| **Calling classes** | `clsAssociationTypeCode` (`SAIF.Business.View.Policy/Associations/clsAssociationTypeCode.vb`) |

> [!IMPORTANT]
> This entry is **not** a missing procedure, **not** a broken reference, and **not** dead code. It is a
> deliberate runtime-dynamic dispatch pattern: the name of the stored procedure to execute is a **data
> value** held in a reference-data table (`ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME`), not a literal
> in source. Static retrieval is therefore impossible by construction — there is no fixed name to hand
> to the Legends CLI. `clsAssociationTypeCode` has live callers through `GetPolicyHeaderAssociations`
> and `GetGroupedPolicyHeaderAssociations` and must not be described as orphaned or dead code.

## Purpose

`GetNonTypedAssociations` executes whatever stored procedure name is supplied at runtime by the
`ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME` reference-data column, to retrieve policy association
rows for a policy. The concrete set of dispatched procedure names is data-defined per environment and is
not enumerable from static source.

## Resolution Chain

All steps below are `verified` in `SAIF.Business.View.Policy/Associations/clsAssociationTypeCode.vb`:

1. **Reference data is read.** `clsAssociationTypeCode.Criteria.Retrieve_SQL` (lines 496-505) selects
   `ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME as SourceProcedureName` from the `ASSOCIATION_TYPE_CODE`
   reference-data table.
2. **The value is materialised onto the object.** `Fill()` (lines 441-450) assigns
   `m_SourceProcedureName = Row.GetString("SourceProcedureName")` (line 444).
3. **It is published on the contract.** `Public ReadOnly Property SourceProcedureName ... Implements
   IPolicyAssociationType.SourceStoredProcedureName` (lines 131-136).
4. **Single-type path.** `GetPolicyHeaderAssociations` (lines 232-233) passes `SourceProcedureName`
   straight into `GetNonTypedAssociations`.
5. **Grouped path.** `GetGroupedPolicyHeaderAssociations` (lines 320-322) derives the name via
   `inAssociationCategoryGrouping.Select(Function(acg) acg.SourceStoredProcedureName).Distinct.Single`,
   enforcing that every association type in a category shares exactly one procedure name (see rule
   PR-BVP-064 in [Business Rules](#business-rules) below).
6. **Execution.** `GetNonTypedAssociations` (lines 344-360) sets
   `DataRequest.CommandType = CommandType.StoredProcedure` and
   `DataRequest.SQLStatement = inSourceProcedureName` (line 354), then binds
   `AddParm("inPolicyNumber", inPolicyNumber)` (line 357) and `AddCursorParm("recordset")` (line 358).

## Procedures / Methods

### Dispatched procedure (name resolved at runtime)

| Field | Value |
| --- | --- |
| **Signature** | Uniform contract for every dispatched procedure: `(inPolicyNumber IN NUMBER, recordset OUT REF CURSOR)` — enforced structurally by step 6 above, which binds exactly those two parameters for every dispatched name |
| **Called by** | `clsAssociationTypeCode.GetNonTypedAssociations` (`clsAssociationTypeCode.vb:344-360`) via `GetPolicyHeaderAssociations` / `GetGroupedPolicyHeaderAssociations` |

#### Parameters

| Parameter | Direction | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `inPolicyNumber` | IN | numeric | — | Uniform contract for every dispatched procedure (`clsAssociationTypeCode.vb:357`) |
| `recordset` | OUT | REF CURSOR | — | Uniform contract (`clsAssociationTypeCode.vb:358`) |

**Target tables:** unknown — vary per dispatched procedure. The concrete set of procedure names is the
distinct set of `SOURCE_PROCEDURE_NAME` values present in `ASSOCIATION_TYPE_CODE` in each environment;
enumerating it requires querying production/environment reference data, which is outside the scope of
static source retrieval. No target table list is recorded here because it is data-defined, not static.

## Business Rules

Rules extracted from this dispatch pattern's logic:

| Rule ID | Rule | Condition | Action |
| --- | --- | --- | --- |
| PR-BVP-064 | All association types grouped into one category must resolve to a single source procedure | `GetGroupedPolicyHeaderAssociations` | `...Select(Function(acg) acg.SourceStoredProcedureName).Distinct.Single` — more than one distinct name throws (`clsAssociationTypeCode.vb:320-322`) |

> This rule is documented in [business-rules.md](../business-rules.md).

## Operations

Operations and processes implemented via this dispatch pattern:

| Operation | Description | Trigger |
| --- | --- | --- |
| Retrieve policy associations (dynamic) | Executes the reference-data-supplied procedure to return association rows for a policy | `clsAssociationTypeCode.GetNonTypedAssociations` (`clsAssociationTypeCode.vb:344-360`) via `GetPolicyHeaderAssociations` / `GetGroupedPolicyHeaderAssociations` |

> This operation is also listed in [operations-processes.md](../operations-processes.md) with source reference back to this document.

## Recommended Follow-Up (optional, not a defect)

If a definitive target list is wanted, run `SELECT DISTINCT SOURCE_PROCEDURE_NAME FROM
ASSOCIATION_TYPE_CODE` against the target environment and retrieve each resulting name individually.

## Source Code

<details>
<summary>Invocation contract (VB.NET, calling side)</summary>

```vb
DataRequest.CommandType  = CommandType.StoredProcedure
DataRequest.SQLStatement = inSourceProcedureName          ' name comes from data
DataRequest.Parameters.AddParm("inPolicyNumber", inPolicyNumber)
DataRequest.Parameters.AddCursorParm("recordset")
```

</details>

## Related Documentation
- [Procedure catalog](index.md)
- [Business rules](../business-rules.md)
- [Operations and processes](../operations-processes.md)
- [SQL catalog](../sql/index.md)

## Sources
- `SAIF.Business.View.Policy/Associations/clsAssociationTypeCode.vb` — lines 131-136, 232-233, 320-322, 344-360 (esp. 354, 357-358), 441-450 (esp. 444), 496-505
